import * as actionType from './actionType'

// 默认初始数据
const initState = {
    warningList: [],
    spinning: false,
    currentPage: 1,
    pageSize: 10
}

// 调用方法判定执行
function reducer(state = initState, action) {
    switch (action.type) {
        case actionType.WARNING_LIST:
            return {
                ...state,
                ...action.warningList
            }
        case actionType.SET_SPINNING:
            return {
                ...state,
                ...action
            }
        case actionType.SET_CURRENTPAGE:
            return {
                ...state,
                ...action
            }
        case actionType.SET_PAGESIZE:
            return {
                ...state,
                ...action
            }
        default:
            return state
    }
}

export default reducer